Thanks for the suggestion, I'll check it out. I think boost::regex is appropriate in this case. I found out a way to make it so that it finds a phrase in a string without caring for case-sensitivity. I also added a small function to add a backslash in front of every dot in the string so that "12A3" cannot be correct using "12.3".
Here's the code:
Code:
void Cours::AnnulerChRegex(std::string& requete)
{
const char* backslash = "\\";
for(int i = 0; i < requete.size(); i++)
{
if(requete[i] == '.')
requete.insert(i++, backslash);
}
}
bool Cours::TrouveSansCasse(std::string recherche, std::string element)
{
AnnulerChRegex(recherche);
std::stringstream tmp;
tmp << ".*" << recherche << ".*";
boost::regex e(tmp.str(), boost::regex::icase);
return boost::regex_match(element, e, boost::match_default);
}